﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
</head>
<body>
<div  id="materialsTree"></div>
</body>
<script>
    layui.use("tree",function(){
        var $ = layui.$;
        layui.tree({
            elem: '#materialsTree',
            nodes:${json}
            ,click: function(node){
                if('${material}'!='add' ){
                    $('#materialsBtn', parent.document).val(node.name);
                    $('#classify', parent.document).val(node.classify);
                    $('#t_d_id', parent.document).val(node.id);
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                }else{
                    if( node.pid !=undefined){
                        $('#materialsBtn', parent.document).val(node.name);
                        $('#classify', parent.document).val(node.classify);
                        $('#t_d_id', parent.document).val(node.id);
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        if(node.classify == 'packagingClassify'){
                            $("#packageCodeDiv",parent.document).css("display","block");
                        }else{
                            $("#packageCodeDiv",parent.document).css("display","none");
                            $("#tMcValue",parent.document).prop("checked","true")
                            $("#tMcValue",parent.document).prop("value","2")
                        }
                    }
                }

            }
        });
    })
</script>
</html>



